<?php
@session_start();
/*
 *  A Part of snock project
 *   Author king-of-war
 * Last modified 2009-4-22
 *
 */
 $root_path='../';
 include_once $root_path . 'admin/smarty_config.php';
include_once $root_path . 'admin/class/fun_common.php';
include_once $root_path . 'admin/class/member.class.php';
include_once $root_path . 'admin/class/cfg.class.php';

/*
 *
 * check identify
 */
include_once $root_path.'admin/class/verify.class.php';
$a=new verify($root_path);
$a->identity_check(3);


$cfg=new cfg($root_path);
  $page_size=$cfg->xml_read('page_num');
$fun = new fun_common($root_path);

$max = $fun->getAll('users', 1);

$member=new member($root_path);
/*
 * page moudle start
 *
 */
if (!empty ($_GET['p'])) {
	$page = $_GET['p'];
} else {
	$page = 1;
}
$pages = $fun->page($page, $page_size, $max);
/*
 * page moulde  end
 *
 *  sort_read($arr)
 */
$arr[0] = $pages['start'];
$arr[1] = $page_size;
/*
 * get the comment of sorts
 */
$users=array();

$pass=$member->member_read($arr,1);



for($i=0;$i<count($pass);$i++){
	$users[$i]['id']=$pass[$i]->get_id();
  $users[$i]['name']=$pass[$i]->get_name();
$group=$pass[$i]->get_group();
 $users[$i]['mail']=$pass[$i]->get_E_mail();
 if($group==1){
 	$users[$i]['group']='会员';
 }else if($group==2){
 	$users[$i]['group']='管理员';
 }else  if($group==3){
 	$users[$i]['group']='系统管理员';
 }
}


/*
 * sort delete moudle
 */

if (isset($_POST['Submit'])) {


		$t=0;
	for ($i = 0; $i < $max; $i++) {

		$id = $users[$i]['id'];

		if ($_POST[$id]!= '') {

			$ids[$t]=$id;
			$t++;
		}

	}

print_r($ids);

 $line=$member->member_del($ids);

if($line){
	echo '<div align="center"><h1>成功删除'.$line.'名用户</h1></div>';
}else{
	echo '<div align="center"><h1>删除失败</h1></div>';
};
}

$smarty->assign("user", $users);
$smarty->assign("page", $pages);
$smarty->assign("url", $root_path);
$smarty->display("member_del.html");

?>


